<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(['middleware' => ['web'], 'namespace' => 'Home'], 
        function () {
            Route::get('', 'IndexController@index');
            Route::get('home', 'IndexController@index');
            Route::any('home/register', 'RegisterController@register');
            Route::post('home/register/store', 'RegisterController@store');
            
            Route::any('home/login', 'LoginController@login');
            Route::any('home/quit', 'LoginController@quit');
            Route::get('home/code', 'LoginController@code');
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web'], 'prefix' => 'admin', 'namespace' => 'Admin'], 
        function () {
            Route::any('login', 'LoginController@login');
            Route::get('code', 'LoginController@code');
});

Route::group(['middleware' => ['web', 'admin.login'], 'prefix' => 'admin', 'namespace' => 'Admin'], 
        function () {
            Route::get('', 'IndexController@index');
            Route::get('quit', 'LoginController@quit');
            Route::get('index', 'IndexController@index');
            Route::get('info', 'IndexController@info');
            
            Route::resource('navigation', 'NavController');            
            Route::resource('user', 'UserController');
            Route::resource('category', 'CategoryController');
            Route::resource('product', 'ProductController');
            
            Route::any('upload', 'CommonController@upload'); 
});